#include <iostream>
#include <algorithm>

template<typename ARRAY_TYPE, typename INDEX_TYPE>
void bubble_sort(ARRAY_TYPE array[], INDEX_TYPE size){
	bool done = false;

	while(!done){
		done = true;
		for(INDEX_TYPE i=0;i<size-1;i++){
			if(array[i]>array[i+1]){
				done = false;
				std::swap(array[i],array[i+1]);
			}
		}
		size--;
		std::for_each(&array[0],&array[10],print<typename>);
		std::cout<<std::endl;
	}
}


/**
int main(){
int array[] = {10,9,8,7,6,5,4,3,2,1};
bubble_sort(array,10);
}
**/